package com.hanrui.android.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hanrui.android.R;
import com.hanrui.android.model.AllYearPerformanceBean;

import javax.inject.Inject;

/**
 * Created by Administrator on 2018/2/9.
 */

public class YearPerformDetailAdapter extends BaseQuickAdapter<AllYearPerformanceBean,BaseViewHolder> {

    String project = "";

    @Inject
    public YearPerformDetailAdapter(){
        super(R.layout.item_yearperformance);
    }

    @Override
    protected void convert(BaseViewHolder helper, AllYearPerformanceBean item) {

        switch (item.getType()) {
            case "1":
                helper.setText(R.id.min_title,"重点工作("+item.getRate()+"%)");
                break;
            case "2":
                helper.setText(R.id.min_title,"常规工作("+item.getRate()+"%)");
                break;
            case "3":
                helper.setText(R.id.min_title,"综合评价("+item.getRate()+"%)");
                break;
        }
        if (!project.equals(item.getType())) {

            helper.setGone(R.id.min_title,true);

        }else {

            helper.setGone(R.id.min_title,false);

        }

        project = item.getType();

        helper.setText(R.id.name,item.getAllYearPlan()).setText(R.id.work_content,item.getFirstQuarterPlan())
                .setText(R.id.carry,item.getFirstQuarterLeader().getName())
                .setText(R.id.work_contenter,item.getSecondQuarterPlan())
                .setText(R.id.carryer,item.getSecondQuarterLeader().getName())
                .setText(R.id.work_contentthree,item.getThirdQuarterPlan())
                .setText(R.id.carrythree,item.getThirdQuarterLeader().getName())
                .setText(R.id.work_contentfour,item.getFourthQuarterPlan())
                .setText(R.id.carryfour,item.getFourthQuarterLeader().getName())
                .setText(R.id.check,item.getRules())
                .setText(R.id.score,String.valueOf(item.getScore()));


    }
}